package kr.co.graviti.adm.common.dao;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import kr.co.graviti.common.dao.BaseFuncDAO;

public class AdmCommonDAO extends BaseFuncDAO{
	
	public AdmCommonDAO() throws Exception {
		super();
	}
	
	/** integer 로 반환(자바 1.4 에서 intger 형태 지원 안해서 똠수)
	 * @param req1
	 * @param query
	 * @return
	 * @throws SQLException
	 */
	public int getIntegerDAO(HashMap req,String query) throws SQLException{
		System.out.println("=============>test");
		String cnt = (String)_sqlmapper.queryForObject(query,req);
		return Integer.parseInt(cnt);
	}
	
	public int getIntegerDAO(String query) throws SQLException{
		String cnt = (String)_sqlmapper.queryForObject(query);
		return Integer.parseInt(cnt);
	}
	
	
		
	/** HashMap 반환 
	 * @param req
	 * @param query
	 * @return
	 * @throws SQLException
	 */
	public HashMap getHashMapDAO(HashMap req,String query) throws SQLException{
		return (HashMap)_sqlmapper.queryForObject(query,req);
	}
	
	public HashMap getHashMapDAO(String query) throws SQLException{
		return (HashMap)_sqlmapper.queryForObject(query);
	}
	
	
	/** ArrayList반환 
	 * @param req
	 * @param query
	 * @return
	 * @throws SQLException
	 */
	public ArrayList getArrayListDAO(HashMap req,String query) throws SQLException{
		return (ArrayList)_sqlmapper.queryForList(query,req);
	}
	
	public ArrayList getArrayListDAO(String query) throws SQLException{
		return (ArrayList)_sqlmapper.queryForList(query);
	}
	
	/** DB TABLE DATA INSERT 
	 * @param req
	 * @param query
	 * @throws SQLException
	 */
	public void setInsertDAO(HashMap req,String query) throws SQLException{
		_sqlmapper.insert(query,req);
	}
	
	public void setInsertDAO(String query) throws SQLException{
		_sqlmapper.insert(query);
	}
	
	/** DB TABLE DATA UPDATE
	 * @param req
	 * @param query
	 * @throws SQLException
	 */
	public void setUpdateDAO(HashMap req,String query) throws SQLException{
		_sqlmapper.update(query,req);
	}

	public void setUpdateDAO(String str,String query) throws SQLException{
		_sqlmapper.update(query,str);
	}
	
	public void setUpdateDAO(String query) throws SQLException{
		_sqlmapper.update(query);
	}
	
	/** DB TABLE DATA DELETE
	 * @param req
	 * @param query
	 * @throws SQLException
	 */
	public void setDeleteDAO(HashMap req,String query) throws SQLException{
		_sqlmapper.delete(query,req);
	}
	public void setDeleteDAO(String query) throws SQLException{
		_sqlmapper.delete(query);
	}
	public void setDeleteDAO(String str,String query) throws SQLException{
		_sqlmapper.delete(query,str);
	}
	
}
